<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>招聘面试</title>
<script type="text/javascript" src="static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" href="static/easyui/themes/icon.css">
<link rel="stylesheet" href="static/easyui/themes/metro-red/easyui.css">
</head>
<body>

<style type="text/css">

.hide{
	display: none;
}
	#interview{
		width: 100%;
		margin:auto;
	    overflow-x: auto;
	    margin-top: 5px;
	    border-collapse: collapse;
	    border: 1px solid #e4e7ec;
	    background-color: #fff;
   		color: gray;
   		font-size:12px; 
	}
	#interview thead{
		color: #19AA8D;
	    font-size: 14px;
	    font-weight: 700;
	} 
	#interview th{
		background: #6666661a;
	}
	#interview td{
		border: 1px solid #e4e7ec;
		width: 150px;
		height: 50px;
	}
.datagrid-header-row td{
		background: #E6E6E6;
		color: #19AA9C;
	    font-size: 14px;
	    font-weight: 700;
	    text-align: center;
	}
	.datagrid-row td{
		background: #fff;
		font-size: 12px;
		text-align: center;
	}
.frhsz{		
		color:white;
		cursor: pointer;
		border:none; 
}
.icon-interview-shanchu{		
		padding-left: 20px;
		background:url('static/easyui/themes/icons/shanchu.png') no-repeat 5% 50%;
		background-color:#FF0000;
}
.looks{
		color:white;
		cursor: pointer;
		border:none;
}
.icon-inteview-chakan{
		padding-left: 20px;
		background:url('static/easyui/themes/icons/queding.png') no-repeat 5% 50%;
		background-color:#1AB394;
}
.icon-inteview-quxiao{
		padding-left: 20px;
		background:url('static/easyui/themes/icons/quxiao.png') no-repeat 5% 50%;
		background-color:#1AB394;
}
.icon-inteview-yly{
		padding-left: 20px;
		background:url('static/easyui/themes/icons/queding.png') no-repeat 5% 50%;
		background-color:#1AB394;
}
#wheathoffer,#wheathnooffer{
		width:400px;
		height:100px;
		margin:auto;
}
.ask{	
		width:400px;
		height:30px;
		margin:auto;
		text-align:center;
		color:#1AB394;
		font-size:15px;
		line-height:30px;
}
.answer{
		width:180px;
		height:30px;
		margin:20px auto;
}
#answeryes,#answeryesoffer,#twosansweryes{
		width:60px;
		height:25px;
		cursor: pointer;
		margin-left: 20px;
		background-color:#1AB394;
		color:white;
		border:none;
}
#answerno,#answernooffer,#twosanswerno{
		width:60px;
		height:25px;
		cursor: pointer;
		margin-left: 20px;
		background-color:white;
		color:black;
		border:solid 1px #D9D9D9;
}
.hide{
		display: none;
}
.bly{
		margin-left:20px;
}
.xinzeng{
		width:30px;
		height:22px;
		color:white;
		cursor: pointer;
		margin-left:20px;
	}
.icon-interview-xinzeng{
		width:16px;
		height:16px;
		padding-left: 20px;
		border:none;
		margin-top:10px;
		background:url('static/easyui/themes/icons/xz-jl.png') no-repeat 5% 50%;
	}
.icon-interview-xzjl{
		width:16px;
		height:16px;
		padding-left: 20px;
		border:none;
		background:url('static/easyui/themes/icons/edit_add.png') no-repeat 5% 50%;
}
</style>
<script type="text/javascript">
	$(function(){		
		xianshi();
		function add(text){
			$("#content-admin").panel({
				href:text
			})
		}	
		//面试中点击新增面试结果按钮跳转到新增界面
		$("#interview-insert").click(function(){
			add("interviewinsert");
		});
		//面试中点击新增面试按钮跳转到新增界面
		$("#insertjl").click(function(){
			add("insertjianli");
		});
	});
	function xianshi(){
		$("#interview").datagrid({
		    url:'select-interview',		    
		    columns:[[
		    	{field:'aa',checkbox:true,title:'选择',width:100},
		    	{field:'riviewid',hidden:true,title:'编号',width:100},
		    	{field:'reasyid',hidden:true},
		    	{field:'rviwerid',hidden:true},
		    	{field:'viewid',title:'序号',width:70},
		    	{field:'riviewname',title:'姓名',width:80},
		    	{field:'riviewway',title:'面试方式',width:90},
		    	{field:'riviewtime',title:'面试时间',width:180,align:'center',
		    		formatter:function(val,rec){
						return formattime(val);
			        }
		    	},
		    	{field:'riviewoption',title:'面试意见',width:210},
		    	{field:'riviewcontent',title:'面试内容',width:240},
		    	{field:'Staff_name',title:'面试官',width:80},
		    	{field:'caozuo',title:'操作',width:280,align:'center',
					formatter: function(value,row,index){
						return "<input type='button' class='ly icon-inteview-chakan' onclick='oneluyong("+row.riviewid+","+row.reasyid+","+row.rviwerid+")' style='width:80px;height: 20px;border:none;font-size:12px;border-radius:4px;color:#fff;background-color:#18A689;cursor: pointer;' value='一次录用'/>"+
						"<input type='button' class='twoly  icon-inteview-chakan' onclick='twoluyong("+row.riviewid+","+row.reasyid+","+row.rviwerid+")' style='width:80px;height: 20px;margin-left:10px;border:none;font-size:12px;border-radius:4px;color:#fff;background-color:#18A689;cursor: pointer;' value='二次录用'/>"+
						"<input type='button' class='bly icon-inteview-quxiao' onclick='buluyong("+row.riviewid+","+row.reasyid+","+row.rviwerid+")' style='margin-left:-5px;width:60px;border:none;height: 20px;font-size:12px;border-radius:4px;color:#fff;background-color:#18A689;margin-left:10px;cursor: pointer;' value='不录用'/>";
					},
				}
		    	]],		           
		         	pagination:true,
				    pageNumber:1,
				    pageSize:5,
				    pageList:[5,10,15]
		    });		
	}
	//点击一次录用按钮弹框
	function oneluyong (id,rid,rrid){
		$("#wheathoffer").window("open");		
		//点击取消按钮
		   $("#answerno").click(function(){
			   $("#wheathoffer").window("close");
		   }); 
		 //点击确定按钮
		   $("#answeryes").click(function(){
			   $("#wheathoffer").window("close");
			   $.ajax({
					 type:"post",
					  url:"luyong",
					  data:{"id":id,"rid":rid,"rrid":rrid,"jie":1},
					  success:function(res){
						if(res==1){
							xianshi();
						}
					  }
				});
			   alert("录用成功!");				
				$(".twoly").addClass("hide");
				$(".bly").addClass("hide");
		   }); 
	}
	//点击二次录用按钮弹框
	function twoluyong (id,rid,rrid){
		$("#wheathtwooffer").window("open");	
		//点击取消按钮
		   $("#twosanswerno").click(function(){
			   $("#wheathtwooffer").window("close");
		   }); 
		 //点击确定按钮
		   $("#twosansweryes").click(function(){
			   $("#wheathtwooffer").window("close");
			   $.ajax({
					 type:"post",
					  url:"luyong",
					  data:{"id":id,"rid":rid,"rrid":rrid,"jie":2},
					  success:function(res){
						if(res==1){
							xianshi();
						}
					  }
				});
			   alert("录用成功!");				
				$(".ly").addClass("hide");
				$(".bly").addClass("hide");
		   }); 
	}
	//点击不录用按钮弹框
	function buluyong (riviewid){
		$("#wheathnooffer").window("open");
		//点击取消按钮
		   $("#answernooffer").click(function(){
			   $("#wheathnooffer").window("close");
		   }); 
		 //点击确定按钮
		   $("#answeryesoffer").click(function(){
			   $("#wheathnooffer").window("close");
				$(".twoly").addClass("hide");
				$(".ly").addClass("hide");			
			   $.ajax({
					 type:"post",
					  url:"luyong",
					  data:{"id":id,"rid":rid,"rrid":rrid,"jie":3},
					  success:function(res){
						if(res==1){
							xianshi();
						}
					  }
				});					
		   }); 
	}		
		 //时间转换
			function formattime(value,row,index){
				var date = new Date(value);
				        var year = date.getFullYear().toString();
				        var month = (date.getMonth() + 1);
				        var day = date.getDate().toString();
				        var hour = date.getHours().toString();
				        var minutes = date.getMinutes().toString();
				        var seconds = date.getSeconds().toString();
				        if (month < 10) {
				            month = "0" + month;
				        }
				        if (day < 10) {
				            day = "0" + day;
				        }
				        if (hour < 10) {
				            hour = "0" + hour;
				        }
				        if (minutes < 10) {
				            minutes = "0" + minutes;
				        }
				        if (seconds < 10) {
				            seconds = "0" + seconds;
				        }
				        return year + "-" + month + "-" + day + " " + hour + ":" + minutes + ":" + seconds;
			}
</script>
	<div class="interview">
	<input type="hidden" id="reasyid">
	<input type="hidden" id="rviwerid">
		<div class="top" style="height:30px;margin:10px auto;">
			<button id="interview-insert" class="xinzeng icon-interview-xinzeng"></button>
			<button id="insertjl" class="xinzeng icon-interview-xzjl"></button>
		</div>	
		<div class="table-center" style="height:500px;margin:auto;">
		<Form id="interviewsc" method="post">
			<table id="interview" class="easyui-datagrid" data-options="height:300">
			</table>
		</Form>
		</div>
</div>

<!--  一次录用弹框-->
<div class="offer">
	<div id="wheathoffer" title="通知" class="easyui-window" data-options="closed:true,minimizable:false,
	maximizable:false,collapsible:false">
		<div class="ask"><span>请问是否录用此人</span></div>
		<div class="answer">
			<button id="answerno">取消</button>
			<button id="answeryes">确定</button>
		</div>
	</div>
</div>
<!--  二次录用弹框-->
<div class="offer">
	<div id="wheathtwooffer" title="通知" class="easyui-window" data-options="closed:true,minimizable:false,
	maximizable:false,collapsible:false">
		<div class="ask"><span>请问是否录用此人</span></div>
		<div class="answer">
			<button id="twosanswerno">取消</button>
			<button id="twosansweryes">确定</button>
		</div>
	</div>
</div>
<!--  取消录用弹框-->
<div class="offer">
	<div id="wheathnooffer" title="通知" class="easyui-window" data-options="closed:true,minimizable:false,
	maximizable:false,collapsible:false">
		<div class="ask"><span>请问是否放弃录用此人</span></div>
		<div class="answer">
			<button id="answernooffer">取消</button>
			<button id="answeryesoffer">确定</button>
		</div>
	</div>
</div>
</body>
</html>